package com.liang.security.springboot.service.impl;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @author liang zai
 * @date 2021/8/31 17:43
 * @description
 */
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
    //根据账号查询用户信息
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return User.withUsername("zhangsan").password("$2a$10$YE///irJ9KLPVQSXuxNkYuaM5Rr7FPmfFU4//OHNFP8qeCwAdYg6S").authorities("p1").build();
    }
}
